<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<!-- 引入主题 -->
<link
	href="${pageContext.request.contextPath}/themes/bootstrap/easyui.css"
	rel="stylesheet">
<!-- 引入按钮 -->
<link href="${pageContext.request.contextPath}/themes/icon.css"
	rel="stylesheet">
<!-- 引入jQuery -->
<script src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
<!-- 引入easyui -->
<script src="${pageContext.request.contextPath}/js/jquery.easyui.min.js"></script>
<script src="${pageContext.request.contextPath}/js/easyui-lang-zh_CN.js"></script>

</head>
<script type="text/javascript">
$(function(){
	$('#searchSeller').searchbox({
		searcher : function(value, name) {
			var sname = value;
			$('#Msg').datagrid('reload', {
				searchsname : sname
			});
		}
	});
	$("#Msg").datagrid({
		url:'${pageContext.request.contextPath }/managerseller',
		striped:true,
		columns : [ [ {
			field : 'checkd',
			checkbox : true,
			width : 40
		}, {
			field : 'sid',
			title : '商家编号',
			width : 40,
			hidden : true
		}, {
			field : 'sname',
			title : '商家',
			width : 200
		}, {
			field : 'sphone',
			title : '电话',
			width : 90,
			align : 'right'
		}, {
			field : 'saddress',
			title : '商家的地址',
			width : 400,
			align : 'right'
		}, {
			field : 'screatetime',
			title : '创建时间',
			width : 130,
			align : 'right'
		}, {
			field : 'semail',
			title : '电子邮箱',
			width : 130,
			align : 'right'
		}
		,  {
			field : 'state',
			title : '商家状态',
			width : 100,
			align : 'right'
		}] ],
		pagination : true,
		toolbar : [  {
			iconCls : 'icon-undo',
			text:'撤销删除',
			handler : function() {
				var sellers = $("#Msg").datagrid('getSelections');
				var count = sellers.length
				if(count>0){
				$.messager.confirm('提示！', '确定要撤销删除？', function(r) {
					if (r) {
						$.ajax({
							type:"post",
							url:"${pageContext.request.contextPath}/cancelsellerdelete",
							data:{"sellers":sellers,"count":count},
							success:function(re){
								if (re == "1") {
									$.messager.alert('我的消息', '撤销成功', 'info', function() {
										$('#Msg').datagrid('reload');
									});
								} else {
									
								}
							}
						})
					}
				})}else{
					$.messager.alert('我的消息',
							'请选择要撤销的用户', 'info',
							function() {
							});
				}	
			}
		} ],
		striped : true,
		rownumbers : true,
		nowrap:false
	});
})
</script>
<body>
<input id="searchSeller" class="easyui-searchbox"
		data-options="prompt:'输入姓名查询信息',width:150">
	<table id="Msg"></table>
</body>
</html>